

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/avatar.gif">
  <link rel="icon" href="/img/avatar.gif">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="马振东">
  <meta name="keywords" content="Java,计算机,数据结构">
  
    <meta name="description" content="一、EXPLAIN简介使用 EXPLAIN 关键字可以模拟优化器执行sql查询语句，从而知道MySQL是如何处理你的sql语句，分析查询语句或者表结构的性能瓶颈.">
<meta property="og:type" content="article">
<meta property="og:title" content="MySQL的 EXPLAIN 使用">
<meta property="og:url" content="https://bolg.plumdong.top/2020/11/19/MySQL%E7%9A%84Explain%E4%BD%BF%E7%94%A8/index.html">
<meta property="og:site_name" content="PlumDong Bolg">
<meta property="og:description" content="一、EXPLAIN简介使用 EXPLAIN 关键字可以模拟优化器执行sql查询语句，从而知道MySQL是如何处理你的sql语句，分析查询语句或者表结构的性能瓶颈.">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-11-18T16:00:00.000Z">
<meta property="article:modified_time" content="2023-03-13T06:57:46.554Z">
<meta property="article:author" content="马振东">
<meta property="article:tag" content="MySQL">
<meta name="twitter:card" content="summary_large_image">
  
  
  
  <title>MySQL的 EXPLAIN 使用 - PlumDong Bolg</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"bolg.plumdong.top","root":"/","version":"1.9.4","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="PlumDong Bolg" type="application/atom+xml">
</head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 60vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>PlumDong Bolg</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                <span>首页</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                <span>归档</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                <span>分类</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                <span>标签</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                <span>关于</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">
              <i class="iconfont icon-dark" id="color-toggle-icon"></i>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="MySQL的 EXPLAIN 使用"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2020-11-19 00:00" pubdate>
          2020年11月19日 凌晨
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          2.1k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          18 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">MySQL的 EXPLAIN 使用</h1>
            
            
              <div class="markdown-body">
                
                <h1 id="一、EXPLAIN简介"><a href="#一、EXPLAIN简介" class="headerlink" title="一、EXPLAIN简介"></a>一、EXPLAIN简介</h1><p>使用 EXPLAIN 关键字可以模拟优化器执行sql查询语句，从而知道MySQL是如何处理你的sql语句，分析查询语句或者表结构的性能瓶颈.</p>
<span id="more"></span>
<h1 id="二、EXPLAIN用法"><a href="#二、EXPLAIN用法" class="headerlink" title="二、EXPLAIN用法"></a>二、EXPLAIN用法</h1><p>EXPLAIN + SQL语句</p>
<p>例子：</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs sql">EXPLAIN <span class="hljs-keyword">select</span> <span class="hljs-operator">*</span> <span class="hljs-keyword">from</span> tbl_emp;<br></code></pre></td></tr></table></figure>
<p>输出：</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs sql"><span class="hljs-operator">+</span><span class="hljs-comment">----+-------------+---------+------------+------+---------------+------+---------+------+------+----------+-------+</span><br><span class="hljs-operator">|</span> id <span class="hljs-operator">|</span> select_type <span class="hljs-operator">|</span> <span class="hljs-keyword">table</span>   <span class="hljs-operator">|</span> partitions <span class="hljs-operator">|</span> type <span class="hljs-operator">|</span> possible_keys <span class="hljs-operator">|</span> key  <span class="hljs-operator">|</span> key_len <span class="hljs-operator">|</span> <span class="hljs-keyword">ref</span>  <span class="hljs-operator">|</span> <span class="hljs-keyword">rows</span> <span class="hljs-operator">|</span> filtered <span class="hljs-operator">|</span> Extra <span class="hljs-operator">|</span><br><span class="hljs-operator">+</span><span class="hljs-comment">----+-------------+---------+------------+------+---------------+------+---------+------+------+----------+-------+</span><br><span class="hljs-operator">|</span>  <span class="hljs-number">1</span> <span class="hljs-operator">|</span> SIMPLE      <span class="hljs-operator">|</span> tbl_emp <span class="hljs-operator">|</span> <span class="hljs-keyword">NULL</span>       <span class="hljs-operator">|</span> <span class="hljs-keyword">ALL</span>  <span class="hljs-operator">|</span> <span class="hljs-keyword">NULL</span>          <span class="hljs-operator">|</span> <span class="hljs-keyword">NULL</span> <span class="hljs-operator">|</span> <span class="hljs-keyword">NULL</span>    <span class="hljs-operator">|</span> <span class="hljs-keyword">NULL</span> <span class="hljs-operator">|</span>    <span class="hljs-number">9</span> <span class="hljs-operator">|</span>   <span class="hljs-number">100.00</span> <span class="hljs-operator">|</span> <span class="hljs-keyword">NULL</span>  <span class="hljs-operator">|</span><br><span class="hljs-operator">+</span><span class="hljs-comment">----+-------------+---------+------------+------+---------------+------+---------+------+------+----------+-------+</span><br></code></pre></td></tr></table></figure>
<p>其中五个比较重要的字段分别为：id、type、key、rows、Extra</p>
<h2 id="ID字段："><a href="#ID字段：" class="headerlink" title="ID字段："></a>ID字段：</h2><p>表示执行的顺序，ID字段分为两种情况：</p>
<ol>
<li>相同：按照顺序从上到下执行</li>
<li>不同：按照ID字段的大小，从大到小执行</li>
<li>既有相同也有不同：把id相同的认为是一组，从上往下顺序执行。 在所有组中首先执行ID数值大的。其中：DERIVED = 衍生</li>
</ol>
<p>注：<br><strong>id 号每个号码， 表示一趟独立的查询。 一个 sql 的查询趟数越少越好。</strong></p>
<h2 id="SELECT-TYPE字段："><a href="#SELECT-TYPE字段：" class="headerlink" title="SELECT_TYPE字段："></a>SELECT_TYPE字段：</h2><p>表示查询类型，主要分为6种：</p>
<ol>
<li><code>SIMPLE</code>  普通查询：简单的select查询，查询中不包含子查询或者union</li>
<li><code>PRIMARY</code>  联合查询：查询中若包含任何复杂的子部分，最外层查询则被标记为联合查询</li>
<li><code>SUBQUERY</code> 子查询：在 select 或 where 列表中包含的子查询</li>
<li><code>DERIVED</code> 嵌套查询：在from列表种包含的子查询被标记为DERIVED（衍生），MySQL会递归执行这些子查询，把结果放到临时表中</li>
<li><code>UNION</code>   连接查询：若查询语句中第二个 select 出现在 UNION 标识符之后，则被标记为 UNION ，若 UNION 包含在from子句中，则外层 select 将被标记为：DERIVED</li>
<li><code>UNION RESULT</code> 从 UNION 表中获取结果的 select</li>
</ol>
<h2 id="TABLE字段："><a href="#TABLE字段：" class="headerlink" title="TABLE字段："></a>TABLE字段：</h2><p>表示与哪一张表相关</p>
<h2 id="TYPE字段："><a href="#TYPE字段：" class="headerlink" title="TYPE字段："></a>TYPE字段：</h2><p>显示访问类型，是一个较为重要的指标，结果值从好到坏依次为：</p>
<figure class="highlight pgsql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs pgsql"><span class="hljs-keyword">system</span> &gt; const &gt; eq_ref &gt; <span class="hljs-keyword">ref</span> &gt; range &gt; <span class="hljs-keyword">index</span> &gt; <span class="hljs-keyword">ALL</span> <br></code></pre></td></tr></table></figure>
<p>一般情况下查询至少达到 <code>range</code> 级别，最好能达到 <code>ref</code> </p>
<ol>
<li>system ：表只有一行记录，平时不会出现，可以忽略</li>
<li>const ：表示通过一次索引就能找到</li>
<li>eq_ref ： 唯一性索引扫描，对于每个索引键，表中只有一条记录与之匹配</li>
<li>ref ： 非唯一性索引扫描，返回匹配某个单独值的所有行，属于查找和扫描的混合体</li>
<li>range ： 只检索给定范围的行，使用一个索引来选择行。key列显示使用了哪个索引</li>
<li>index ： 与ALL区别是只遍历索引树</li>
<li>ALL ： 全表扫描</li>
</ol>
<h2 id="POSSIBLE-KEYS和KEY字段："><a href="#POSSIBLE-KEYS和KEY字段：" class="headerlink" title="POSSIBLE_KEYS和KEY字段："></a>POSSIBLE_KEYS和KEY字段：</h2><p>possible_keys</p>
<ul>
<li>显示可能应用在这张表种的索引，一个或多个。</li>
<li>查询涉及到的字段上若存在索引，则索引将被列出，<code>但不一定被查询实际使用</code></li>
</ul>
<p>key</p>
<ul>
<li>实际使用的索引，如果为null则证明没有使用索引</li>
<li>查询中若使用了覆盖索引，则该索引仅出现在key列表中</li>
<li>查询使用的索引时以<code>key</code>列为准</li>
</ul>
<h2 id="key-len-字段："><a href="#key-len-字段：" class="headerlink" title="key_len 字段："></a>key_len 字段：</h2><ul>
<li>表示索引种使用的字节数，可通过该列计算查询中使用的索引长度。在不损失精度的情况下，长度越短越好</li>
<li>key_len 显示的值为索引字段的最大可能长度，<code>并非实际使用长度</code>，即key_len是根据表定义计算而得，不是通过表内检索出的</li>
</ul>
<h2 id="ref字段："><a href="#ref字段：" class="headerlink" title="ref字段："></a>ref字段：</h2><p>显示索引的哪一列被使用了，可能是一个常数，哪些列或者常量被用于查找索引列的值</p>
<h2 id="rows字段："><a href="#rows字段：" class="headerlink" title="rows字段："></a>rows字段：</h2><p>显示表有多少行被优化器查询，是一个衡量索引优化的重要指标，值越小越好</p>
<h2 id="Extra-字段："><a href="#Extra-字段：" class="headerlink" title="Extra 字段："></a>Extra 字段：</h2><p>包含不适合在其他列种显示但十分重要的额外信息，其可能的信息</p>
<ol>
<li><p><code>Using filesort</code> ： MySQL无法利用索引完成排序操作，需要自己重新从对数据进行排序</p>
</li>
<li><p><code>Using temporary</code> ： MySQL无法利用索引完成分组，需要创建临时表来完成分组</p>
</li>
<li><p><code>Using index</code> ： 查询的列被所建的索引覆盖，只需要从索引中获取数据，不必读数据行，查询到的数据叫覆盖索引，效率较高</p>
</li>
<li><p>Using where ：表明使用了where过滤</p>
</li>
<li><p>Using join buff ：表明 join 次数过多，应调大缓冲区的join buff</p>
</li>
<li><p>impossible where：表明where子句的值总是false</p>
</li>
</ol>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/MySQL/" class="category-chain-item">MySQL</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/MySQL/">#MySQL</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>MySQL的 EXPLAIN 使用</div>
      <div>https://bolg.plumdong.top/2020/11/19/MySQL的Explain使用/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>马振东</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2020年11月19日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2020/11/19/MySQL%E4%B8%83%E7%A7%8DJOIN%E7%90%86%E8%AE%BA/" title="MySQL七种JOIN理论">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">MySQL七种JOIN理论</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2020/11/17/linux(centos7)%E5%AE%89%E8%A3%85MySQL5.7/" title="linux(centos7)安装MySQL5.7">
                        <span class="hidden-mobile">linux(centos7)安装MySQL5.7</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
